package com.mall.order.dto;

import com.mall.commons.result.AbstractRequest;
import com.mall.commons.tool.exception.ValidateException;
import com.mall.order.constant.OrderRetCode;
import lombok.Data;

@Data
public class AllUserOrderRequest extends AbstractRequest {
    private Integer page;
    private Integer size;
    private String sort;
    private String username;

    @Override
    public void requestCheck() {
        if (page == null ){
            page = 1;
        }
        if (size == null) {
            size = 5;
        }
        if (username == null) {
            throw new ValidateException(OrderRetCode.REQUISITE_PARAMETER_NOT_EXIST.getCode(), OrderRetCode.REQUISITE_PARAMETER_NOT_EXIST.getMessage());
        }
    }
}
